
{% extends 'base_main.html' %}

{% block meta %}
  {{ block.super }}
{% endblock %}

{% block title %}
  <title>写文章 - DDF博客管理系统</title>
{% endblock %}

{% block css %}
  {{ block.super }}
{% endblock %}

{% block js %}
    <script src="/static/js/jquery-2.1.4.min.js"></script>
<!--[if gte IE 9]>
     <script src="/static/js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="/static/js/html5shiv.min.js" type="text/javascript"></script>
    <script src="/static/js/respond.min.js" type="text/javascript"></script>
    <script src="/static/js/selectivizr-min.js" type="text/javascript"></script>
<![endif]-->
    {% load static %}
    <script type="text/javascript" src="{% static 'kindeditor/kindeditor-all.js' %}"></script>
    <script type="text/javascript" src="{% static 'kindeditor/lang/zh-CN.js' %}"></script>
    <script type="text/javascript">
        KindEditor.ready(function(K) {
                window.editor = K.create('#editor_id',{
                    uploadJson:'/util/upload/kindeditor'
                });
        });
    </script>
{% endblock %}

{% block content%}
<section class="container-fluid">
  <header>
    <nav class="navbar navbar-default navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">切换导航</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
          <a class="navbar-brand" href="{% url 'user:index' %}">SAMSARA</a> </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav navbar-right">
            <li><a href="">消息 <span class="badge">1</span></a></li>
            <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ user.username }}<span class="caret"></span></a>
              <ul class="dropdown-menu dropdown-menu-left">
                <li><a title="查看或修改个人信息" data-toggle="modal" data-target="#seeUserInfo">个人信息</a></li>
                <li><a title="查看您的登录记录" data-toggle="modal" data-target="#seeUserLoginlog">登录记录</a></li>
              </ul>
            </li>
            <li><a href="{% url 'user:logout' %}" onClick="if(!confirm('是否确认退出？'))return false;">退出登录</a></li>
            <li><a data-toggle="modal" data-target="#WeChat">帮助</a></li>
          </ul>
          <form action="" method="post" class="navbar-form navbar-right" role="search">
            <div class="input-group">
              <input type="text" class="form-control" autocomplete="off" placeholder="键入关键字搜索" maxlength="15">
              <span class="input-group-btn">
              <button class="btn btn-default" type="submit">搜索</button>
              </span> </div>
          </form>
        </div>
      </div>
    </nav>
  </header>
  <div class="row">
    <aside class="col-sm-3 col-md-2 col-lg-2 sidebar">
      <ul class="nav nav-sidebar">
        <li><a href="{% url 'user:index' %}">报告</a></li>
      </ul>
      <ul class="nav nav-sidebar">
        <li class="active"><a href="{% url 'article:article' %}">文章</a></li>
      </ul>
      <ul class="nav nav-sidebar">
        <li><a href="{% url 'category:category' %}">栏目</a></li>
      </ul>
    </aside>
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-lg-10 col-md-offset-2 main" id="main">
      <div class="row">
          <form action="" method="post" class="add-article-form">
              {% csrf_token %}
              {{ msg }}
              <div class="col-md-9">
                  <h1 class="page-header">撰写新文章</h1>
                  <div class="form-group">
                      <label for="article-title" class="sr-only">标题</label>
                      <input type="text" id="article-title" name="title" class="form-control" placeholder="在此处输入标题" required autofocus autocomplete="off">
                  </div>
                  <div class="form-group">
                      <label for="article-content" class="sr-only">内容</label>
                          <p id="article-content" style="font-size:20px">内容</p>
                          <textarea id="editor_id" name="content"></textarea>
                  </div>
                  <div class="add-article-box">
                      <h2 class="add-article-box-title"><span>关键字</span></h2>
                      <div class="add-article-box-content">
                          <input type="text" class="form-control" placeholder="请输入关键字" name="keywords" autocomplete="off">
                          <span class="prompt-text">多个标签请用英文逗号,隔开。</span>
                      </div>
                  </div>
                  <div class="add-article-box">
                      <h2 class="add-article-box-title"><span>描述</span></h2>
                      <div class="add-article-box-content">
                          <textarea class="form-control" name="describe" autocomplete="off"></textarea>
                          <span class="prompt-text">描述是可选的手工创建的内容总结，并可以在网页描述中使用</span>
                      </div>
                  </div>
              </div>
              <div class="col-md-3">
                  <h1 class="page-header">操作</h1>
                  <div class="add-article-box">
                      <h2 class="add-article-box-title"><span>栏目</span></h2>
                      <div class="add-article-box-content">
                          <ul class="category-list">
                              {% for category in categories %}
                              <li>
                                  <label>
                                      <input name="category" type="radio" value="{{ category.id }}" checked>
                                       {{ category.name }}<em class="hidden-md">( 栏目ID: <span>{{ forloop.counter }}</span> )</em></label>
                              </li>
                              {% endfor %}
                          </ul>
                      </div>
                  </div>
                  <div class="add-article-box">
                      <h2 class="add-article-box-title"><span>标签</span></h2>
                      <div class="add-article-box-content">
                          <input type="text" class="form-control" placeholder="输入新标签" name="tags" autocomplete="off">
                          <span class="prompt-text">多个标签请用英文逗号,隔开</span> </div>
                  </div>
                  <div class="add-article-box">
                      <h2 class="add-article-box-title"><span>标题图片</span></h2>
                      <div class="add-article-box-content">
                          <input type="file">
                      </div>
                  </div>
                  <div class="add-article-box">
                      <h2 class="add-article-box-title"><span>发布</span></h2>
                      <div class="add-article-box-content">
                          <p><label>状态：</label><span class="article-status-display">未发布</span></p>
                          <p><label>公开度：</label><input type="radio" name="visibility" value="0" checked/>公开 <input type="radio" name="visibility" value="1" />加密</p>
                          <p><label>暂不开放"发布于"时间功能</label><span class="article-time-display"></span></p>
                      </div>
                      <div class="add-article-box-footer">
                          <input class="btn btn-primary" type="submit" value="发布">
              </div>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</section>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/admin-scripts.js"></script>
<script src="/static/lib/ueditor/ueditor.config.js"></script>
<script src="/static/lib/ueditor/ueditor.all.min.js"> </script>
<script src="/static/lib/ueditor/lang/zh-cn/zh-cn.js"></script>
<script id="uploadEditor" type="text/plain" style="display:none;"></script>
{% endblock %}
